import _sfc_main from "./index.vue2.mjs";
import { resolveComponent, createElementBlock, openBlock, createVNode, withCtx, normalizeClass, createSlots, createBlock, createCommentVNode, createTextVNode, toDisplayString, createElementVNode, withDirectives, vShow } from "vue";
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
const _hoisted_1 = { class: "ep-container" };
const _hoisted_2 = {
  key: 0,
  style: { "display": "flex", "width": "100%" }
};
const _hoisted_3 = ["src"];
const _hoisted_4 = {
  key: 1,
  class: "ep-preview-cover-file-icon"
};
const _hoisted_5 = { class: "el-upload-list__item-info" };
const _hoisted_6 = { class: "el-upload-list__item-name" };
const _hoisted_7 = { class: "el-upload-list__item-file-name" };
const _hoisted_8 = { class: "el-upload-list__item-name" };
const _hoisted_9 = { style: { "color": "#a8abb2" } };
const _hoisted_10 = {
  key: 2,
  class: "el-upload-list__item-status-label"
};
const _hoisted_11 = {
  key: 4,
  class: "el-icon--close-tip"
};
const _hoisted_12 = {
  key: 1,
  class: "el-upload-list__item-actions"
};
const _hoisted_13 = ["onClick"];
const _hoisted_14 = {
  key: 0,
  class: "el-upload-list__item-action"
};
const _hoisted_15 = {
  key: 2,
  class: "flex-center"
};
const _hoisted_16 = ["src"];
const _hoisted_17 = {
  key: 1,
  class: "ep-preview-cover-file-icon"
};
const _hoisted_18 = { class: "el-upload-list__item-actions" };
const _hoisted_19 = ["onClick"];
const _hoisted_20 = ["onClick"];
const _hoisted_21 = ["onClick"];
const _hoisted_22 = {
  key: 0,
  class: "el-upload__tip"
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_Plus = resolveComponent("Plus");
  const _component_el_icon = resolveComponent("el-icon");
  const _component_el_button = resolveComponent("el-button");
  const _component_el_progress = resolveComponent("el-progress");
  const _component_Check = resolveComponent("Check");
  const _component_Close = resolveComponent("Close");
  const _component_ZoomIn = resolveComponent("ZoomIn");
  const _component_Download = resolveComponent("Download");
  const _component_Delete = resolveComponent("Delete");
  const _component_el_upload = resolveComponent("el-upload");
  const _component_el_form_item = resolveComponent("el-form-item");
  return openBlock(), createElementBlock("div", _hoisted_1, [
    createVNode(_component_el_form_item, {
      label: _ctx.options.label,
      prop: _ctx.options.name,
      "show-message": !_ctx.isDetail,
      class: "ep-form-item"
    }, {
      default: withCtx(() => [
        createVNode(_component_el_upload, {
          ref: "fieldRef",
          class: normalizeClass(["ep-fileupload-container", [{ hiddenUploadBtn: _ctx.hiddenUploadBtn }]]),
          "file-list": _ctx.fileList,
          "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.fileList = $event),
          style: { width: "100%" },
          accept: "image/*",
          action: _ctx.options.action,
          disabled: _ctx.options.disabled || _ctx.options.camera,
          limit: _ctx.options.limit,
          "list-type": _ctx.options.listType,
          "before-upload": _ctx.handleBeforeUpload,
          "on-success": _ctx.handleOnSuccess,
          "on-error": _ctx.handleOnError,
          "on-exceed": _ctx.handleOnExceed,
          "http-request": _ctx.handleHttpRequest
        }, createSlots({
          tip: withCtx(() => [
            _ctx.options.tip && !_ctx.isDetail ? (openBlock(), createElementBlock("div", _hoisted_22, toDisplayString(_ctx.options.tip), 1)) : createCommentVNode("", true)
          ]),
          default: withCtx(() => [
            _ctx.options.listType === "picture-card" && !_ctx.isDetail && !_ctx.hiddenUploadBtn ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
              default: withCtx(() => [
                createVNode(_component_Plus)
              ]),
              _: 1
            })) : createCommentVNode("", true),
            _ctx.options.listType !== "picture-card" && !_ctx.isDetail && !_ctx.hiddenUploadBtn ? (openBlock(), createBlock(_component_el_button, {
              key: 1,
              type: "default"
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(_ctx.options.btn || "添加"), 1)
              ]),
              _: 1
            })) : createCommentVNode("", true)
          ]),
          _: 2
        }, [
          _ctx.options.listType !== "text" ? {
            name: "file",
            fn: withCtx(({ file }) => [
              _ctx.options.listType === "picture" ? (openBlock(), createElementBlock("div", _hoisted_2, [
                _ctx.getFileType(file).includes("image/") ? (openBlock(), createElementBlock("img", {
                  key: 0,
                  class: "el-upload-list__item-thumbnail",
                  src: file.url,
                  alt: ""
                }, null, 8, _hoisted_3)) : (openBlock(), createElementBlock("div", _hoisted_4)),
                createElementVNode("div", _hoisted_5, [
                  createElementVNode("a", _hoisted_6, [
                    createElementVNode("span", _hoisted_7, toDisplayString(file.name), 1)
                  ]),
                  createElementVNode("a", _hoisted_8, [
                    createElementVNode("span", _hoisted_9, toDisplayString(Number((file.size || 0) / 1024 / 1024).toFixed(2) + " MB"), 1)
                  ]),
                  file.status === "uploading" ? (openBlock(), createBlock(_component_el_progress, {
                    key: 0,
                    type: "line",
                    "stroke-width": 2,
                    percentage: Number(file.percentage || 0),
                    style: { "margin-top": "0.5rem" }
                  }, null, 8, ["percentage"])) : createCommentVNode("", true)
                ]),
                !_ctx.isDetail ? (openBlock(), createElementBlock("label", _hoisted_10, [
                  createVNode(_component_el_icon, { class: "el-icon--upload-success el-icon--check" }, {
                    default: withCtx(() => [
                      createVNode(_component_Check)
                    ]),
                    _: 1
                  })
                ])) : createCommentVNode("", true),
                !_ctx.isDetail ? (openBlock(), createBlock(_component_el_icon, {
                  key: 3,
                  class: "el-icon--upload-success el-icon--close"
                }, {
                  default: withCtx(() => [
                    createVNode(_component_Close, {
                      onClick: ($event) => _ctx.handleRemove(file)
                    }, null, 8, ["onClick"])
                  ]),
                  _: 2
                }, 1024)) : createCommentVNode("", true),
                !_ctx.isDetail ? (openBlock(), createElementBlock("i", _hoisted_11, "按 delete 键可删除")) : createCommentVNode("", true)
              ])) : createCommentVNode("", true),
              _ctx.options.listType === "picture" ? (openBlock(), createElementBlock("div", _hoisted_12, [
                createElementVNode("span", {
                  class: "el-upload-list__item-preview",
                  onClick: ($event) => _ctx.handlePictureCardPreview(file)
                }, [
                  withDirectives(createVNode(_component_el_icon, null, {
                    default: withCtx(() => [
                      createVNode(_component_ZoomIn)
                    ]),
                    _: 1
                  }, 512), [
                    [vShow, _ctx.getFileType(file).includes("image/")]
                  ])
                ], 8, _hoisted_13),
                _ctx.isDetail ? (openBlock(), createElementBlock("span", _hoisted_14, [
                  createVNode(_component_el_icon, {
                    class: "action-icon",
                    onClick: ($event) => _ctx.downloadFile(file)
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_Download)
                    ]),
                    _: 1
                  }, 8, ["onClick"])
                ])) : createCommentVNode("", true)
              ])) : createCommentVNode("", true),
              _ctx.options.listType === "picture-card" ? (openBlock(), createElementBlock("div", _hoisted_15, [
                _ctx.getFileType(file).includes("image/") ? (openBlock(), createElementBlock("img", {
                  key: 0,
                  class: "el-upload-list__item-thumbnail",
                  src: file.url,
                  alt: ""
                }, null, 8, _hoisted_16)) : (openBlock(), createElementBlock("div", _hoisted_17)),
                file.status === "uploading" ? (openBlock(), createBlock(_component_el_progress, {
                  key: 2,
                  type: "circle",
                  width: 90,
                  "stroke-width": 5,
                  percentage: Number(file.percentage || 0),
                  style: { "display": "flex", "justify-content": "center", "align-items": "center" }
                }, null, 8, ["percentage"])) : createCommentVNode("", true),
                createElementVNode("span", _hoisted_18, [
                  _ctx.getFileType(file).includes("image/") ? (openBlock(), createElementBlock("span", {
                    key: 0,
                    class: "el-upload-list__item-preview",
                    onClick: ($event) => _ctx.handlePictureCardPreview(file)
                  }, [
                    createVNode(_component_el_icon, null, {
                      default: withCtx(() => [
                        createVNode(_component_ZoomIn)
                      ]),
                      _: 1
                    })
                  ], 8, _hoisted_19)) : createCommentVNode("", true),
                  _ctx.isDetail ? (openBlock(), createElementBlock("span", {
                    key: 1,
                    class: "el-upload-list__item-download",
                    onClick: ($event) => _ctx.downloadFile(file)
                  }, [
                    createVNode(_component_el_icon, null, {
                      default: withCtx(() => [
                        createVNode(_component_Download)
                      ]),
                      _: 1
                    })
                  ], 8, _hoisted_20)) : createCommentVNode("", true),
                  !_ctx.isDetail ? (openBlock(), createElementBlock("span", {
                    key: 2,
                    class: "el-upload-list__item-delete",
                    onClick: ($event) => _ctx.handleRemove(file)
                  }, [
                    createVNode(_component_el_icon, null, {
                      default: withCtx(() => [
                        createVNode(_component_Delete)
                      ]),
                      _: 1
                    })
                  ], 8, _hoisted_21)) : createCommentVNode("", true)
                ])
              ])) : createCommentVNode("", true)
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["file-list", "class", "action", "disabled", "limit", "list-type", "before-upload", "on-success", "on-error", "on-exceed", "http-request"])
      ]),
      _: 1
    }, 8, ["label", "prop", "show-message"])
  ]);
}
const Index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
  Index as default
};
